Avoid some unnecessary TLB flushes. This will probably make no real
authorsos22@douglas.cl.cam.ac.uk <sos22@douglas.cl.cam.ac.uk>
Fri, 15 Jul 2005 09:24:29 +0000 (09:24 +0000)
committersos22@douglas.cl.cam.ac.uk <sos22@douglas.cl.cam.ac.uk>
Fri, 15 Jul 2005 09:24:29 +0000 (09:24 +0000)
difference on any sensible guest operating system.

Signed-off-by: Steven Smith, sos22@cl.cam.ac.uk.
xen/arch/x86/mm.c

index 2c530cf26114b97c24845d6fef82c081356b9323..a8c9708f584089618142c6537e1ec2a5eb6d2f5c 100644 (file)
@@ -1352,18 +1352,22 @@ int get_page_type(struct pfn_info *page, u32 type)
         {
             if ( (x & (PGT_type_mask|PGT_va_mask)) != type )
             {
-                /*
-                 * On type change we check to flush stale TLB entries. This 
-                 * may be unnecessary (e.g., page was GDT/LDT) but those
-                 * circumstances should be very rare.
-                 */
-                cpumask_t mask = page_get_owner(page)->cpumask;
-                tlbflush_filter(mask, page->tlbflush_timestamp);
-
-                if ( unlikely(!cpus_empty(mask)) )
+                if ( (x & PGT_type_mask) != (type & PGT_type_mask) )
                 {
-                    perfc_incrc(need_flush_tlb_flush);
-                    flush_tlb_mask(mask);
+                    /*
+                     * On type change we check to flush stale TLB
+                     * entries. This may be unnecessary (e.g., page
+                     * was GDT/LDT) but those circumstances should be
+                     * very rare.
+                     */
+                    cpumask_t mask = page_get_owner(page)->cpumask;
+                    tlbflush_filter(mask, page->tlbflush_timestamp);
+
+                    if ( unlikely(!cpus_empty(mask)) )
+                    {
+                        perfc_incrc(need_flush_tlb_flush);
+                        flush_tlb_mask(mask);
+                    }
                 }
 
                 /* We lose existing type, back pointer, and validity. */